package com.example.productserver.result;

import java.util.List;

public class ResultQuery<T> extends ResultBase {
    private static final long serialVersionUID = 1L;
    private Integer totalItems; // 总条数
    private List<T> data;
    public Integer getTotalItems() {
        return totalItems;
    }

    public void setTotalItems(Integer totalItems) {
        this.totalItems = totalItems;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    /**
     * 获取起始行
     *
     * @param currPage
     * @param size
     * @return
     */
    public static Integer getStart(Integer currPage, Integer size) {
        Integer start = null;
        if (null != currPage && null != size) {
            start = (currPage - 1) * size;
        }
        return start;
    }
}
